package auth_service

import "gin_blog/models"

//type Auth struct {
//	Username string
//	Password string
//}

type Auth struct {
	Username string
	Nickname string
	Phone    string
	Avatar   string
	Password string
}

func (a *Auth) Check() (bool, error) {
	return models.CheckAuth(a.Phone)
}
func (a *Auth) GetUser() (*models.Auth, error) {
	return models.GetUser(a.Phone)
}
func (a *Auth) AddUser() error {
	return models.AddUser(map[string]interface{}{
		"user_name": a.Username,
		"nick_name": a.Nickname,
		"phone":     a.Phone,
		"password":  a.Password,
	})
}
func (a *Auth) IsTelephoneExist() (bool, error,*models.Auth) {
	return models.IsTelephoneExist(a.Phone)
}
func (a *Auth) IsNicknameExist() (bool, error) {
	return models.IsNicknameExist(a.Nickname)
}
